package com.codefish;

/**
 * 百分比打折策略
 *
 * @author codefish
 * @version 1.0
 * @date 2022/05/07 下午 03:18
 */
public class RateDiscount implements IDiscount {
    /**
     * 折扣百分比
     */
    private final double rate;

    public RateDiscount(double rate) {
        this.rate = rate;
    }

    @Override
    public double countDiscount(double price) {
        return price * rate;
    }
}
